--[[=========================================================
	TABLE CREATION FUNCTIONS
=========================================================]]--
if SERVER then

--[[-----------------------------------------------------]]--
--	Sound Info
--[[-----------------------------------------------------]]--
local function CreateSoundInfoTable()

	--	If table exists skip creation
	if sql.TableExists( "SoundInfo" ) then
		DEBUG:Msg( "Skipped creation of 'SoundInfo' because it already exists", "CreateSoundInfoTable" )
		return true
	end
	
	--	Prepare the query
	local query		= "CREATE TABLE SoundInfo ( "
	query = query	.. "ID int PRIMARY KEY, "
	query = query	.. "Name varchar(255), "
	query = query	.. "Display varchar(255), "
	query = query	.. "File varchar(255), "
	query = query	.. "IsLoop boolean, "
	query = query	.. "Duration float, "
	query = query	.. "Delay float )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'SoundInfo' table ...", "CreateSoundInfoTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	Activity Info
--[[-----------------------------------------------------]]--
local function CreateActivityInfoTable()

	--	If table exists skip creation
	if sql.TableExists( "ActivityInfo" ) then
		DEBUG:Msg( "Skipped creation of 'ActivityInfo' because it already exists", "CreateActivityInfoTable" )
		return true
	end
	
	--	Prepare the query
	local query		= "CREATE TABLE ActivityInfo ( "
	query = query	.. "ID int PRIMARY KEY, "
	query = query	.. "Name varchar(255), "
	query = query	.. "Display varchar(255), "
	query = query	.. "Activity int,"
	query = query	.. "Duration float, "
	query = query	.. "Delay float )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'ActivityInfo' table ...", "CreateActivityInfoTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	Damage Info
--[[-----------------------------------------------------]]--
local function CreateDamageInfoTable()

	--	If table exists skip creation
	if sql.TableExists( "DamageInfo" ) then
		DEBUG:Msg( "Skipped creation of 'DamageInfo' because it already exists", "CreateDamageInfoTable" )
		return true
	end
	
	--	Prepare the query
	local query		= "CREATE TABLE DamageInfo ( "
	query = query	.. "ID int PRIMARY KEY, "
	query = query	.. "BaseDamage int, "
	query = query	.. "ChestMultiplier float, "
	query = query	.. "GearMultiplier float, "
	query = query	.. "GenericMultiplier float, "
	query = query	.. "HeadMultiplier float, "
	query = query	.. "LeftArmMultiplier float, "
	query = query	.. "RightArmMultiplier float, "
	query = query	.. "LeftLegMultiplier float, "
	query = query	.. "RightLegMultiplier float, "
	query = query	.. "StomachMultiplier float )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'DamageInfo' table ...", "CreateDamageInfoTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	View Transform Info
--[[-----------------------------------------------------]]--
local function CreateViewTransformInfoTable()

	--	If table exists skip creation
	if sql.TableExists( "ViewTransformInfo" ) then
		DEBUG:Msg( "Skipped creation of 'ViewTransformInfo' because it already exists", "CreateViewTransformInfoTable" )
		return true
	end
	
	--	Prepare the query
	local query		= "CREATE TABLE ViewTransformInfo ( "
	query = query	.. "ID int PRIMARY KEY, "
	query = query	.. "PositionX float, "
	query = query	.. "PositionY float, "
	query = query	.. "PositionZ float, "
	query = query	.. "AngleP float, "
	query = query	.. "AngleY float, "
	query = query	.. "AngleR float, "
	query = query	.. "FOV float, "
	query = query	.. "CheckDistance float )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'ViewTransformInfo' table ...", "CreateViewTransformInfoTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	Object Type
--[[-----------------------------------------------------]]--
local function CreateObjectTypeTable()

	--	If table exists skip creation
	if sql.TableExists( "ObjectType" ) then
		DEBUG:Msg( "Skipped creation of 'ObjectType' because it already exists", "CreateObjectTypeTable" )
		return true
	end
	
	--	Prepare the query
	local query			= "CREATE TABLE ObjectType ( "
	query = query		.. "ID int PRIMARY KEY, "
	query = query		.. "Name varchar(255), "
	query = query		.. "Display varchar(255), "
	query = query		.. "ClassName varchar(255) )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'ObjectType' table ...", "CreateObjectTypeTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	Weapon
--[[-----------------------------------------------------]]--
local function CreateWeaponTable()

	--	If table exists skip creation
	if sql.TableExists( "Weapon" ) then
		DEBUG:Msg( "Skipped creation of 'Weapon' because it already exists", "CreateWeaponTable" )
		return true
	end
	
	--	Prepare the query
	local query		= "CREATE TABLE Weapon ( "
	query = query	.. "ID int PRIMARY KEY, "
	query = query	.. "Base varchar(255), "
	query = query	.. "Name varchar(255), "
	query = query	.. "Display varchar(255), "
	query = query	.. "AutoSwitchTo boolean, "
	query = query	.. "AutoSwitchFrom boolean, "
	query = query	.. "CSMuzzleFlashes boolean, "
	query = query	.. "Spawnable boolean, "
	query = query	.. "AdminSpawnable boolean )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'Weapon' table ...", "CreateWeaponTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	Firemode
--[[-----------------------------------------------------]]--
local function CreateFiremodeTable()

	--	If table exists skip creation
	if sql.TableExists( "Firemode" ) then
		DEBUG:Msg( "Skipped creation of 'Firemode' because it already exists", "CreateFiremodeTable" )
		return true
	end
	
	--	Prepare the query
	local query		= "CREATE TABLE Firemode ( "
	query = query	.. "ID int PRIMARY KEY, "
	query = query	.. "Name varchar(255), "
	query = query	.. "Display varchar(255), "
	query = query	.. "Color varchar(10), "
	query = query	.. "Automatic boolean, "
	query = query	.. "AmmoType varchar(255), "
	query = query	.. "ClipSize int, "
	query = query	.. "DefaultClip int, "
	query = query	.. "BurstCount int, "
	query = query	.. "ReloadCount int, "
	query = query	.. "BuckShotCount int, "
	query = query	.. "DamageInfo int, "					--	Damage Info
	query = query	.. "MeleeDamage int, "					--	Damage Info
	query = query	.. "Spread float, "
	query = query	.. "Precision float, "
	query = query	.. "RecoilUp float, "
	query = query	.. "RecoilDown float, "
	query = query	.. "RecoilLeft float, "
	query = query	.. "RecoilRight float, "
	query = query	.. "MuzzleEffect varchar(255), "
	query = query	.. "SwayScaleNormal float, "
	query = query	.. "SwayScaleIronSights float, "
	query = query	.. "BobScaleNormal float, "
	query = query	.. "BobScaleIronSights float, "
	query = query	.. "IdleDelay float, "
	query = query	.. "DeployDelay float, "
	query = query	.. "ShootDelay float, "
	query = query	.. "ReloadDelay float, "
	query = query	.. "BurstDelay float, "
	query = query	.. "StopReloadDelay float, "
	query = query	.. "SwitchModeDelay float, "
	query = query	.. "SightsInDelay float, "
	query = query	.. "SightsOutDelay float, "
	query = query	.. "ScopeInDelay float, "
	query = query	.. "ScopeOutDelay float, "
	query = query	.. "HolsterInDelay float, "
	query = query	.. "HolsterOutDelay float, "
	query = query	.. "RunInDelay float, "
	query = query	.. "RunOutDelay float, "
	query = query	.. "WallInDelay float, "
	query = query	.. "WallOutDelay float, "
	query = query	.. "MeleeDelay float, "
	query = query	.. "IdleSound int, "					--	Sound Info
	query = query	.. "DeploySound int, "					--	Sound Info
	query = query	.. "ShootSound int, "					--	Sound Info
	query = query	.. "EmptySound int, "					--	Sound Info
	query = query	.. "ReloadSound int, "					--	Sound Info
	query = query	.. "StopReloadSound int, "				--	Sound Info
	query = query	.. "SwitchModeSound int, "				--	Sound Info
	query = query	.. "SightsInSound int, "				--	Sound Info
	query = query	.. "SightsOutSound int, "				--	Sound Info
	query = query	.. "ScopeInSound int, "					--	Sound Info
	query = query	.. "ScopeOutSound int, "				--	Sound Info
	query = query	.. "HolsterInSound int, "				--	Sound Info
	query = query	.. "HolsterOutSound int, "				--	Sound Info
	query = query	.. "RunInSound int, "					--	Sound Info
	query = query	.. "RunOutSound int, "					--	Sound Info
	query = query	.. "WallInSound int, "					--	Sound Info
	query = query	.. "WallOutSound int, "					--	Sound Info
	query = query	.. "MeleeSound int, "					--	Sound Info
	query = query	.. "IdleActivity int, "					--	Activity Info
	query = query	.. "DeployActivity int, "				--	Activity Info
	query = query	.. "ShootActivity int, "				--	Activity Info
	query = query	.. "ReloadActivity int, "				--	Activity Info
	query = query	.. "StopReloadActivity int, "			--	Activity Info
	query = query	.. "SwitchModeActivity int, "			--	Activity Info
	query = query	.. "SightsInActivity int, "				--	Activity Info
	query = query	.. "SightsOutActivity int, "			--	Activity Info
	query = query	.. "ScopeInActivity int, "				--	Activity Info
	query = query	.. "ScopeOutActivity int, "				--	Activity Info
	query = query	.. "HolsterInActivity int, "			--	Activity Info
	query = query	.. "HolsterOutActivity int, "			--	Activity Info
	query = query	.. "RunActivity int, "					--	Activity Info
	query = query	.. "WallActivity int, "					--	Activity Info
	query = query	.. "MeleeActivity int, "				--	Activity Info
	query = query	.. "ModePicture varchar(255), "
	query = query	.. "AmmoPicture varchar(255), "
	query = query	.. "ScopePicture varchar(255), "
	query = query	.. "SightsTransform int, "				--	ViewTransformInfo
	query = query	.. "HolsterTransform int, "				--	ViewTransformInfo
	query = query	.. "RunTransform int, "					--	ViewTransformInfo
	query = query	.. "RunHolsteredTransform int, "		--	ViewTransformInfo
	query = query	.. "WallTransform int, "				--	ViewTransformInfo
	query = query	.. "WallHolsteredTransform int, "		--	ViewTransformInfo
	query = query	.. "MeleeTransform int, "				--	ViewTransformInfo
	query = query	.. "ScopeTransform int )"				--	ViewTransformInfo
	
	--	Debug output
	DEBUG:Msg( "Creating 'Firemode' table ...", "CreateFiremodeTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	Weapon Firemode
--[[-----------------------------------------------------]]--
local function CreateWeaponFiremodeTable()

	--	If table exists skip creation
	if sql.TableExists( "WeaponFiremode" ) then
		DEBUG:Msg( "Skipped creation of 'WeaponFiremode' because it already exists", "CreateWeaponFiremodeTable" )
		return true
	end
	
	--	Prepare the query
	local query		= "CREATE TABLE WeaponFiremode ( "
	query = query	.. "Weapon int, "
	query = query	.. "Firemode int, "
	query = query	.. "StartEnabled boolean, "
	query = query	.. "HoldType varchar(30), "
	query = query	.. "CanUseIronSights boolean, "
	query = query	.. "CanHolster boolean, "
	query = query	.. "UseRunView boolean, "
	query = query	.. "CanUseMelee boolean, "
	query = query	.. "UseWallView boolean, "
	query = query	.. "UseScope boolean, "
	query = query	.. "AutoReloadOnEmpty boolean, "
	query = query	.. "CanReloadOnlyOnEmpty boolean, "
	query = query	.. "CanInterruptReload boolean, "
	query = query	.. "CONSTRAINT PK_WeaponFiremode PRIMARY KEY ( Weapon, Firemode ) )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'WeaponFiremode' table ...", "CreateWeaponFiremodeTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	Object Info
--[[-----------------------------------------------------]]--
local function CreateObjectInfoTable()

	--	If table exists skip creation
	if sql.TableExists( "ObjectInfo" ) then
		DEBUG:Msg( "Skipped creation of 'ObjectInfo' because it already exists", "CreateObjectInfoTable" )
		return true
	end
	
	--	Prepare the query
	local query		= "CREATE TABLE ObjectInfo ( "
	query = query	.. "ID int PRIMARY KEY, "
	query = query	.. "Name varchar(255), "
	query = query	.. "Health int, "
	query = query	.. "Weight int, "
	query = query	.. "Type int, "
	query = query	.. "Item int, "
	query = query	.. "Price float )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'ObjectInfo' table ...", "CreateObjectInfoTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	Inventory
--[[-----------------------------------------------------]]--
local function CreateInventoryTable()

	--	If table exists skip creation
	if sql.TableExists( "Inventory" ) then
		DEBUG:Msg( "Skipped creation of 'Inventory' table because it already exists", "CreateInventoryTable" )
		return true
	end
	
	--	Prepare the query
	local query			= "CREATE TABLE Inventory ( "
	query = query		.. "ID int PRIMARY KEY, "
	query = query		.. "Name varchar(255), "
	query = query		.. "SlotCount int, "
	query = query		.. "Display varchar(255) )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'Inventory' table ...", "CreateInventoryTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	Loadout Position
--[[-----------------------------------------------------]]--
local function CreateLoadoutPositionTable()

	--	If table exists skip creation
	if sql.TableExists( "LoadoutPosition" ) then
		DEBUG:Msg( "Skipped creation of 'LoadoutPosition' table because it already exists", "CreateLoadoutPositionTable" )
		return true
	end
	
	--	Prepare the query
	local query			= "CREATE TABLE LoadoutPosition ( "
	query = query		.. "ID int PRIMARY KEY, "
	query = query		.. "Name varchar(255), "
	query = query		.. "X float, "
	query = query		.. "Y float, "
	query = query		.. "Display varchar(255) )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'LoadoutPosition' table ...", "CreateLoadoutPositionTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	Loadout
--[[-----------------------------------------------------]]--
local function CreateLoadoutTable()

	--	If table exists skip creation
	if sql.TableExists( "Loadout" ) then
		DEBUG:Msg( "Skipped creation of 'Loadout' table because it already exists", "CreateLoadoutTable" )
		return true
	end
	
	--	Prepare the query
	local query			= "CREATE TABLE Loadout ( "
	query = query		.. "ID int PRIMARY KEY, "
	query = query		.. "Name varchar(255), "
	query = query		.. "Display varchar(255) )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'Loadout' table ...", "CreateLoadoutTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	Loadout Position Link
--[[-----------------------------------------------------]]--
local function CreateLoadoutPositionLinkTable()

	--	If table exists skip creation
	if sql.TableExists( "LoadoutPositionLink" ) then
		DEBUG:Msg( "Skipped creation of 'LoadoutPositionLink' table because it already exists", "CreateLoadoutPositionLinkTable" )
		return true
	end
	
	--	Prepare the query
	local query			= "CREATE TABLE LoadoutPositionLink ( "
	query = query		.. "Loadout int, "
	query = query		.. "LoadoutPosition int, "
	query = query		.. "Name varchar(255), "
	query = query		.. "Display varchar(255), "
	query = query		.. "CONSTRAINT PK_LoadoutPositionLink PRIMARY KEY ( Loadout, LoadoutPosition ) )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'LoadoutPositionLink' table ...", "CreateLoadoutPositionLinkTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	Loadout Inventory
--[[-----------------------------------------------------]]--
local function CreateLoadoutInventoryTable()

	--	If table exists skip creation
	if sql.TableExists( "LoadoutInventory" ) then
		DEBUG:Msg( "Skipped creation of 'LoadoutInventory' table because it already exists", "CreateLoadoutInventoryTable" )
		return true
	end
	
	--	Prepare the query
	local query			= "CREATE TABLE LoadoutInventory ( "
	query = query		.. "Inventory int, "
	query = query		.. "LoadoutPositionLink int, "
	query = query		.. "Display varchar(255), "
	query = query		.. "CONSTRAINT PK_LoadoutInventory PRIMARY KEY ( Inventory, LoadoutPositionLink ) )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'LoadoutInventory' table ...", "CreateLoadoutInventoryTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	Player Loadout
--[[-----------------------------------------------------]]--
local function CreatePlayerLoadoutTable()

	--	If table exists skip creation
	if sql.TableExists( "PlayerLoadout" ) then
		DEBUG:Msg( "Skipped creation of 'PlayerLoadout' table because it already exists", "CreatePlayerLoadoutTable" )
		return true
	end
	
	--	Prepare the query
	local query			= "CREATE TABLE PlayerLoadout ( "
	query = query		.. "ID int, "
	query = query		.. "Loadout int, "
	query = query		.. "Name varchar(255), "
	query = query		.. "Display varchar(255) )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'PlayerLoadout' table ...", "CreatePlayerLoadoutTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	Inventory Object
--[[-----------------------------------------------------]]--
local function CreateInventoryObjectTable()

	--	If table exists skip creation
	if sql.TableExists( "InventoryObject" ) then
		DEBUG:Msg( "Skipped creation of 'InventoryObject' table because it already exists", "CreateInventoryObjectTable" )
		return true
	end
	
	--	Prepare the query
	local query			= "CREATE TABLE InventoryObject ( "
	query = query		.. "Object int, "
	query = query		.. "LoadoutInventory int, "
	query = query		.. "PlayerLoadout int, "
	query = query		.. "SlotPosition int, "
	query = query		.. "Display varchar(255), "
	query = query		.. "CONSTRAINT PK_InventoryObject PRIMARY KEY ( Object, LoadoutInventory, PlayerLoadout ) )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'InventoryObject' table ...", "CreateInventoryObjectTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	Team Info
--[[-----------------------------------------------------]]--
local function CreateTeamInfoTable()

	--	If table exists skip creation
	if sql.TableExists( "TeamInfo" ) then
		DEBUG:Msg( "Skipped creation of 'TeamInfo' because it already exists", "CreateTeamInfoTable" )
		return true
	end
	
	--	Prepare the query
	local query		= "CREATE TABLE TeamInfo ( "
	query = query	.. "ID int PRIMARY KEY, "
	query = query	.. "Name varchar(255), "
	query = query	.. "Color varchar(50), "
	query = query	.. "MaxPercent int, "
	query = query	.. "ChatName varchar(255), "
	query = query	.. "DefaultLoadout int, "
	query = query	.. "CreateTime int )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'TeamInfo table ...", "CreateTeamInfoTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	Player Info
--[[-----------------------------------------------------]]--
local function CreatePlayerInfoTable()

	--	If table exists skip creation
	if sql.TableExists( "PlayerInfo" ) then
		DEBUG:Msg( "Skipped creation of 'PlayerInfo' table because it already exists", "CreatePlayerInfoTable" )
		return true
	end
	
	--	Prepare the query
	local query			= "CREATE TABLE PlayerInfo ( "
	query = query		.. "SteamID varchar(255) PRIMARY KEY, "
	query = query		.. "FirstJoin int, "
	query = query		.. "LastJoin int, "
	query = query		.. "PlayerLoadout int, "
	query = query		.. "Team int, "
	query = query		.. "Money float )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'PlayerInfo' table ...", "CreatePlayerInfoTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	User Info
--[[-----------------------------------------------------]]--
local function CreateUserInfoTable()

	--	If table exists skip creation
	if sql.TableExists( "UserInfo" ) then
		DEBUG:Msg( "Skipped creation of 'UserInfo' because it already exists", "CreateUserInfoTable" )
		return true
	end
	
	--	Prepare the query
	local query		= "CREATE TABLE UserInfo ( "
	query = query	.. "PlayerInfo int PRIMARY KEY, "
	query = query	.. "Login varchar(255), "
	query = query	.. "Password varchar(255), "
	query = query	.. "AdminLevel int )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'UserInfo' table ...", "CreateUserInfoTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[-----------------------------------------------------]]--
--	Player Stats
--[[-----------------------------------------------------]]--
local function CreatePlayerStatsTable()

	--	If table exists skip creation
	if sql.TableExists( "PlayerStats" ) then
		DEBUG:Msg( "Skipped creation of 'PlayerStats' because it already exists", "CreatePlayerStatsTable" )
		return true
	end
	
	--	Prepare the query
	local query		= "CREATE TABLE PlayerStats ( "
	query = query	.. "PlayerInfo int, "
	query = query	.. "Kills int, "
	query = query	.. "Deaths int, "
	query = query	.. "Rescued int, "
	query = query	.. "Escaped int, "
	query = query	.. "FriendsKilled int, "
	query = query	.. "EnemiesRescued int, "
	query = query	.. "Experience int, "
	query = query	.. "Level int,"
	query = query	.. "CONSTRAINT PK_PlayerStats PRIMARY KEY ( PlayerInfo ) )"
	
	--	Debug output
	DEBUG:Msg( "Creating 'PlayerStats' table ...", "CreatePlayerStatsTable" )
	
	--	Execute the query
	return sql.Query( query )
end

--[[=========================================================
	GAMEMODE FUNCTIONS
=========================================================]]--

--[[-----------------------------------------------------]]--
--	Create the database
--[[-----------------------------------------------------]]--
sql.CreateDataBase		= function()

	--	Variables
	local result		= true
	
	--	Create the tables
	result = result		&& ( CreateSoundInfoTable()				!= false )
	result = result		&& ( CreateActivityInfoTable()			!= false )
	result = result		&& ( CreateDamageInfoTable()			!= false )
	result = result		&& ( CreateViewTransformInfoTable()		!= false )
	result = result		&& ( CreateObjectTypeTable()			!= false )
	result = result		&& ( CreateWeaponTable()				!= false )
	result = result		&& ( CreateFiremodeTable()				!= false )
	result = result		&& ( CreateWeaponFiremodeTable()		!= false )
	result = result		&& ( CreateObjectInfoTable()			!= false )
	result = result		&& ( CreateInventoryTable()				!= false )
	result = result		&& ( CreateLoadoutPositionTable()		!= false )
	result = result		&& ( CreateLoadoutTable()				!= false )
	result = result		&& ( CreateLoadoutPositionLinkTable()	!= false )
	result = result		&& ( CreateLoadoutInventoryTable()		!= false )
	result = result		&& ( CreatePlayerLoadoutTable()			!= false )
	result = result		&& ( CreateInventoryObjectTable()		!= false )
	result = result		&& ( CreateTeamInfoTable()				!= false )
	result = result		&& ( CreatePlayerInfoTable()			!= false )
	result = result		&& ( CreateUserInfoTable()				!= false )
	result = result		&& ( CreatePlayerStatsTable()			!= false )
	
	--	Debug output - error
	if not result then
		DEBUG:ErrMsg( "Error while trying to create the database. Last error: " .. sql.LastError(), "GM.CreateDataBase" )
		
	--	Debug output - success
	else
		DEBUG:Msg( "The database tables have been successfully created !", "GM.CreateDataBase" )
	end
	
	--	Return the result
	return result
end

end